package org.jackysoft.ztree;

import org.jackysoft.entity.TreeNode;

public class TreeNodeZtreeFunction extends
		AbstractZTreeFunction<TreeNode> {

	private boolean nocheck = true;

	public TreeNodeZtreeFunction(boolean nocheck) {
		this.nocheck = nocheck;
	}

	public TreeNodeZtreeFunction() {
	}

	@Override
	public ZTreeNode apply(TreeNode from) {

		ZTreeNode zn = new ZTreeNode();
		zn.setId(from.getId() + "");
		zn.setName(from.getText());
		zn.setNocheck(nocheck);
		zn.setIsParent((!from.isLeaf()) + "");
		zn.setSort(from.getSort());
		zn.setHref(from.getUrl());
		zn.setVisiable(from.isVisiable());
		zn.attr("contextType", from.getContextType());
		return zn;
	}

}
